Recently some people complain that they cannot set the maxmem for
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 15 Jul 2005 08:30:22 +0000 (08:30 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 15 Jul 2005 08:30:22 +0000 (08:30 +0000)
domU. The problem is that some code wrongly treat dom.max_memkb as in
byte unit, instead of KB unit. This patch fixs the problem.

Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
tools/libxc/xc_domain.c
tools/libxc/xc_linux_save.c

index a341bb0bc36064dca397f5159826c284d7885fb1..688dbb970afd792efdc2863749224b9cb2437f79 100644 (file)
@@ -107,7 +107,7 @@ int xc_domain_getinfo(int xc_handle,
 
         info->ssidref  = op.u.getdomaininfo.ssidref;
         info->nr_pages = op.u.getdomaininfo.tot_pages;
-        info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT);
+        info->max_memkb = op.u.getdomaininfo.max_pages << (PAGE_SHIFT - 10);
         info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
         info->cpu_time = op.u.getdomaininfo.cpu_time;
         info->vcpus = op.u.getdomaininfo.n_vcpu;
index f761141170f062bb5c8b09436864612b9e885486..023a59c799189ac881571187628950f9e94fd76f 100644 (file)
@@ -464,15 +464,15 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom)
         goto out;
     }
     
-    nr_pfns = info.max_memkb >> PAGE_SHIFT; 
+    nr_pfns = info.max_memkb >> (PAGE_SHIFT - 10);
 
     /* cheesy sanity check */
-    if ( nr_pfns > 1024*1024 ){
+    if ( nr_pfns > 1024*1024 )
+    {
         ERR("Invalid state record -- pfn count out of range: %lu", nr_pfns);
         goto out;
     }
 
-
     /* Map the shared info frame */
     live_shinfo = xc_map_foreign_range(xc_handle, dom,
                                         PAGE_SIZE, PROT_READ,